﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UserGUI : MonoBehaviour {
    private IUserAction action;
    public GUISkin myskin ;
    private bool game_start = false;
    private int act_mode = 0;
    
    public int getMode(){
        return act_mode;
    }
	
    void Start () {
        myskin = Resources.Load<GUISkin>("GUIskin/other_skin");
        action = SSDirector.GetInstance().CurrentScenceController as IUserAction;
    }
    
  
	void OnGUI () {
        GUI.skin = myskin;
        if (game_start) {
            GUI.Label(new Rect(Screen.width -200, 5, 180, 50), "分数:"+ action.GetScore().ToString());

            if (action.GetRound() == 4) {
                GUI.Label(new Rect(Screen.width / 2 - 100, Screen.height / 2-150, 200, 100), "游戏结束");
                if (GUI.Button(new Rect(Screen.width / 2 - 80, Screen.height / 2 -50 , 160, 100), "重新开始")) {
                    action.Remake();
                    return;
                }
                action.GameOver();
            }
            if(act_mode==0){
                if(GUI.Button(new Rect(0, 0 , 150, 80), "普通模式\n更改模式"))
                    act_mode= 1;
            }else
            {
                if(GUI.Button(new Rect(0, 0 , 150, 80), "物理模式\n更改模式"))
                    act_mode= 0;
            }
        }
        else {
            GUI.Label(new Rect(Screen.width / 2 - 100, Screen.height / 2-150, 200, 100), "鼠标打飞碟");
            if (GUI.Button(new Rect(Screen.width / 2 - 80, Screen.height / 2 -50 , 160, 100), "START")) {
                game_start = true;
                action.Remake();
            }
        }
    }
   
}
